package InputOutputStreamDemo;

import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Scanner;

public class FileWriterDemo {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);
            Writer fw = new FileWriter("D:\\Demo-Java\\java-demo-hbnu\\src\\a.txt",true);
            ){
            System.out.println("《静夜思》打印...");
            //写字符出去
            String msg = "《静夜思》"+"\r\n"+
                    "床前明月光，"+"\r\n"+"疑是地上霜。"
                    +"\r\n"+"举头望明月，"+"\r\n"+"低头思故乡。";
            fw.write(msg);
            fw.write("\r\n------------------------");//换行符
//            fw.flush();//刷新流
//            fw.close();//关闭流里面就包含了刷新流

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
